import app from './app'
import { logger } from './services/logger'

const port = process.env.PORT || 3000

// 启动服务器
app.listen(port, () => {
    logger.info(`Server is running on port ${port}`)
    logger.info(`Frontend URL: ${process.env.FRONTEND_URL || 'http://localhost:5173'}`)
})

// 处理未捕获的异常
process.on('uncaughtException', (error) => {
    logger.error('Uncaught Exception:', error)
    process.exit(1)
})

// 处理未处理的 Promise 拒绝
process.on('unhandledRejection', (reason, promise) => {
    logger.error('Unhandled Rejection:', reason)
}) 